let query = (location.search).substring(1);
// let query = window.location.href.split('?')[1]
console.log(query);
query = decodeURI(query) 
let vars = query.split("&");
console.log(vars);                // ['title=三星平板电视', 'brandtitleid=0']
let item = vars[1].split("=")[1]
console.log(item);
let item1 = vars[0].split("=")[1];
console.log(item1);
 let aObj = document.querySelector('.oa')
 console.log(aObj);
 aObj.innerHTML = `${item1}>`



const xhr = new XMLHttpRequest();

 xhr.open("get",`http://chst.vip:1234/api/getbrandproductlist?brandtitleid=${item}`);
//  // xhr.open("get",`http://chst.vip:1234/api/getbrandtitle?categoryid=${item}`);
 

 xhr.send(null);

 xhr.onreadystatechange = function(){
     let oul = document.querySelector("ul");
     if(xhr.readyState === 4){
         if(xhr.status === 200){
             let res = JSON.parse(xhr.responseText);
             console.log(res)

             // let regExp = /(?<=imgurl=)[^'"]*/;
             let ele = "";
             res.result.forEach(item => {
                 // console.log(item);
                 var img = item.productImg;
                 // console.log(img);
                 ele += `<li>
                             <a href="./bijiaxq.html?categoryid=${item.categoryId}&productid=${item.productId}&brandname=${item.brandName}">
                                 ${img}
                                 <div>
                                     <h4>${item.productName}</h4>
                                     <span>${item.productPrice}</span>
                                     <br>
                                     <p>${item.productQuote}</p>
                                     <i>${item.productCom}</i>
                                 </div>
                             </a>
                         </li>`
                 
                 
                 // `<li>
                 //             <h4>${item.productName}</h4>
                 //             <span>${item.productFrom} | ${item.productTime}</span>
                 //             <i>${item.productTips}</i>
                 //             <img src="${img}" alt="">
                 //             <p>${item.productInfo2}</p>
                 //         </li>`
                 
             });
             oul.innerHTML = ele;

             // &brandName=${item.brandName}
         }
     }
 }